package org.madgecko.api.dao.impl;

import org.madgecko.api.dao.iface.IMemberDao;
import org.madgecko.api.model.Member;
import org.madgecko.basic.dao.BaseDao;
import org.madgecko.basic.dao.IBaseDao;
import org.madgecko.basic.model.User;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Author       : MadFrog
 * Date         : 2019/6/16 16:18
 * Description  :
 */
@Repository
public class MemberDao extends BaseDao<Member> implements IMemberDao {

    @Override
    public Member loadByUserName(String name) {
        String hql = "from Member m where m.username=?";
        return (Member) this.queryObject(hql, name);
    }

    @Override
    public List<Member> listAllByScore() {
        String hql = "from Member m where m.status>0 order by m.score desc";
        return this.list(hql);
    }
}
